
function bindEvent_message(){
    $(".service_message").click(function(){
        if($('#pay_record_page').length>0){
            $('#pay_record_page').remove();
        }
        $("body").append(html_content.pay_record);
        $("#"+page_index[page_index.length-1]).hide();
        $("#pay_record_page").show();
        getPayRecord()
        page_index.push("pay_record_page");
        $('body').attr('class','search_body')    
    });
}
function getPayRecord(){
    var mobilephone=getLoginPhone();
    if(mobilephone){
        var spinner = new Spinner();   
        $.ajax({
            type: "POST",
            url: webConfig.url+"/Home/Index/getOrderPay",
            data: {mobilephone:mobilephone},
            dataType: "JSONP",
            crossDomain: true,
            beforeSend:function(){
                // $('#loadingBox').removeClass('hidden')
                // var target = document.getElementById('loadingBox');
                // spinner.spin(target)
            },
            complete:function(){
                // $('#loadingBox').addClass('hidden')
                // spinner.spin()
            },
            success: function(data){
                var content='';
               if(data['next_pay']){
                    if(data['next_pay']['next_pay_days']>=0){
                        content+='<li class="mui-table-view-cell mui-media">\
                                <a>\
                                    <img class="mui-media-object mui-pull-left ImgX" src="images/jinggao.png">\
                                    <div class="mui-media-body">\
                                        <p class="mui-ellipsis pWhite">本次还款金额<span>'+parseInt(data['next_pay']['next_pay'])+'</span>元，距离还款时间<span>'+data['next_pay']['next_pay_days']+'</span>天，请在银行尾号<span>'+data['next_pay']['banknum']+'</span>的卡中准备好足够的余额。</p>\
                                        <p class="pWhite mui-ellipsis Pt">已还款<span>'+data['next_pay']['pay_month']+'</span>期，还款总额 <span>'+parseInt(data['next_pay']['paymoney'])+'</span>元。</p>\
                                    </div>\
                                </a>\
                            </li>'
                    }else{
                        content+='<li class="mui-table-view-cell mui-media">\
                                <a>\
                                    <img class="mui-media-object mui-pull-left ImgX" src="images/jinggao.png">\
                                    <div class="mui-media-body">\
                                        <p class="mui-ellipsis pWhite">本次还款金额<span>'+parseInt(data['next_pay']['next_pay'])+'</span>元，逾期<span>'+(0-data['next_pay']['next_pay_days'])+'</span>天，请在银行尾号<span>'+data['next_pay']['banknum']+'</span>的卡中准备好足够的余额。</p>\
                                        <p class="pWhite mui-ellipsis Pt">已还款<span>'+data['next_pay']['pay_month']+'</span>期，还款总额 <span>'+parseInt(data['next_pay']['paymoney'])+'</span>元。</p>\
                                    </div>\
                                </a>\
                            </li>'
                    }
                    
               } 
               if(data['order_pay']){
                    for(var i in data['order_pay']){
                        if(data['order_pay'][i]['pay_month']=="0"){
                            content+='<li class="mui-table-view-cell mui-media">\
                                    <a>\
                                        <img class="mui-media-object mui-pull-left ImgX" src="images/wancheng.png">\
                                        <div class="mui-media-body">\
                                            <p class="mui-ellipsis pWhite">本次支付金额：<span>'+parseInt(data['order_pay'][i]['money'])+'</span>元，支付时间：<span>'+data['order_pay'][i]['create_time']+'</span>。</p>\
                                            <!--<p class="pWhite mui-ellipsis Pt">已还款<span>'+data['order_pay'][i]['pay_month']+'</span>期，还款总额 '+parseInt(data['order_pay'][i]['paymoney'])+'</span>元。</p>-->\
                                        </div>\
                                    </a>\
                                </li>'
                        }else{
                             content+='<li class="mui-table-view-cell mui-media">\
                                    <a>\
                                        <img class="mui-media-object mui-pull-left ImgX" src="images/wancheng.png">\
                                        <div class="mui-media-body">\
                                            <p class="mui-ellipsis pWhite">本次还款金额：<span>'+parseInt(data['order_pay'][i]['money'])+'</span>元，还款时间：<span>'+data['order_pay'][i]['create_time']+'</span>。</p>\
                                            <p class="pWhite mui-ellipsis Pt">已还款<span>'+data['order_pay'][i]['pay_month']+'</span>期，还款总额 '+parseInt(data['order_pay'][i]['paymoney'])+'</span>元。</p>\
                                        </div>\
                                    </a>\
                                </li>'
                        }
                    }
                    
               }
               if(content){
                    content='<ul class="mui-table-view">'+content+'</ul>'
               }
               $('.pay_record_content').html(content);
               mui('.mui-scroll-wrapper').scroll({
                    deceleration: 0.005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006 
                });
               
            },
            error:function(){
                
            }
        });
    
    }
}
